package edu.cuny.baruch.cis9590.library.entities;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "purchases")
public final class Purchase {
	private int purchase_id;
	private int book_id;
	private int patron_id;
	private float price;
	private Date date;
	
	public Purchase() {
	    
	}
	
	public Purchase(int bookId, int patronId, float price) {
	    this.date = new Date();
	    this.book_id = bookId;
	    this.patron_id = patronId;
	    this.price = price;
	}
	
	@Id
	@Column(name = "purchase_id")
	@GeneratedValue(generator = "increment")
	@GenericGenerator(name = "increment", strategy = "increment")
	public int getPurchaseid() {
		return purchase_id;
	}

	public void setPurchaseid(int purchase_id) {
		this.purchase_id = purchase_id;
	}

	@Column(name = "book_id")
	public int getBookid() {
		return book_id;
	}

	public void setBookid(int book_id) {
		this.book_id = book_id;
	}

	@Column(name = "patron_id")
	public int getPatronid() {
		return patron_id;
	}

	public void setPatronid(int patronid) {
		this.patron_id = patronid;
	}

	@Column(name = "price")
	public float getPrice() {
		return price;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	@Column(name = "Date")
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

}